package com.qf.service;

import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("service1")
public class UserServiceImpl1 implements UserService{
    @Autowired
    private UserMapper userMapper;

//    public UserMapper getUserMapper() {
//        return userMapper;
//    }
//
//    //进行set注入
//    public void setUserMapper(UserMapper userMapper) {
//        this.userMapper = userMapper;
//    }

    //从jdbc.properties文件中根据key拿value值
    @Value("${jdbc.url}")
    private String url;

    @Value("${jdbc.username}")
    private String username;


    @Override
    public List<User> findALL() {
        //直接用注入的UserMapper对象
        List<User> list = userMapper.findUserAll();
        System.out.println("=====url======" + url);
        System.out.println("=====username======" + username);
        return list;
    }
}
